package io.renren.util;

import java.util.Arrays;


public class QuestionUtil {

    public static String[] getOptionArr() {
        String[] strArr = new String[20];
        strArr[0] = "A";
        strArr[1] = "B";
        strArr[2] = "C";
        strArr[3] = "D";
        strArr[4] = "E";
        strArr[5] = "F";
        strArr[6] = "G";
        strArr[7] = "H";
        strArr[8] = "I";
        strArr[9] = "J";
        strArr[10] = "K";
        strArr[11] = "L";
        strArr[12] = "M";
        strArr[13] = "N";
        strArr[14] = "O";
        strArr[15] = "P";
        strArr[16] = "Q";
        strArr[17] = "R";
        strArr[18] = "S";
        strArr[19] = "T";
        return strArr;
    }

    public static String getOptionStr() {
        String str = "ABCDEFGHIJKLMNOPQRST";
        return str;
    }

    /**
     * 判断字符串里面是否含有重复的字符，如果有返回true，否则返回false
     *
     * @param @param  tmp
     * @param @return
     * @return boolean
     * @throws
     * @Description: TODO
     * @author yzw
     * @date 2016年12月5日
     */
    public static boolean isExist(String tmp) {
        boolean isOk = false;
        char[] tmpchar = tmp.toCharArray();
        for (int i = 0; i < tmpchar.length; i++) {
            for (int j = i + 1; j < tmpchar.length; j++) {
                if (tmpchar[i] == tmpchar[j]) {
                    isOk = true;
                    return isOk;
                } else {
                    isOk = false;
                }
            }
        }
        return isOk;
    }

    /**
     * 对英文字符串进行排序
     *
     * @param @param  source
     * @param @return
     * @return String
     * @throws
     * @Description: TODO
     * @author yzw
     * @date 2017年2月15日
     */
    public static String sortCapital(String source) {
        if (source == null) {
            return "";
        }
        source = source.toUpperCase();// 全部字符串转为大写
        char[] c = source.toCharArray();// 将字符串转换成char数组
        Arrays.sort(c);// 对数组进行排序
        String str = "";
        for (char i : c) {
            str += i;
        }
        return str;// 返回数组。注：char数组相当于String类型
    }


}
